package com.icepeach.icepeachhomeback.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.icepeach.icepeachhomeback.common.RelationEnum;
import com.icepeach.icepeachhomeback.dto.ArticleDto;
import com.icepeach.icepeachhomeback.entity.Article;
import com.icepeach.icepeachhomeback.entity.User;
import com.icepeach.icepeachhomeback.req.ArticleListQueryReq;
import com.icepeach.icepeachhomeback.service.ArticleService;
import com.icepeach.icepeachhomeback.mapper.ArticleMapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* @author 张皓冰
* @description 针对表【article】的数据库操作Service实现
* @createDate 2023-04-19 09:57:28
*/
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article>
    implements ArticleService{

    @Override
    public IPage<ArticleDto> getArticlesByPage(ArticleListQueryReq articleListQueryReq) {

            IPage<ArticleDto> page=new Page<>(articleListQueryReq.getPageNum(),articleListQueryReq.getPageSize());
            Map<String,Object> map=new HashMap<>();

            if(StrUtil.isNotBlank(articleListQueryReq.getTitle())){
                map.put("title",articleListQueryReq.getTitle());
            }




        return baseMapper.selectMyPage(page,map);
        }

}




